/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demo.controller;

import demo.model.dao.ProductDA;
import demo.model.dto.ProductTO;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Admin
 */
public class HomeController extends WebController {

    public void display(HttpServletRequest request, HttpServletResponse response) throws Exception {
        getListProduct(request, response);
        setTitle(LANGUAGE.get("homepage"), request);
        forward("home.jsp", request, response);
    }

    public void getListProduct(HttpServletRequest request, HttpServletResponse response) throws Exception {
        ProductDA productDA = new ProductDA(DB_SETTING, SQL_BUNDLE);
        ArrayList<ProductTO> listProduct = productDA.getAllProduct();
        request.setAttribute("listProduct", listProduct);
    }
}
